# redis连接
def getRedis():
    from django_redis import get_redis_connection
    conn = get_redis_connection()
    return conn


from ronglian_sms_sdk import SmsSDK
accId = '8aaf07087a331dc7017a566327980fde'
accToken = '924f42b72a544ee39daf56efa5b84c58'
appId = '8aaf07087a331dc7017a566328c70fe5'

import json


def send_message(mobile,code,time):
    sdk = SmsSDK(accId, accToken, appId)
    tid = '1'
    datas = (code, time)
    resp = sdk.sendMessage(tid, mobile, datas)
    result = json.loads(resp)
    if result['statusCode'] == '000000':
        return 1
    return 2